#include "standarddialogs.h"
//#include "ui_standarddialogs.h"
#include <QtWidgets/QFileDialog>
#include <QtWidgets>
#include <QtGui>

StandardDialogs::StandardDialogs(QWidget *parent)
    : QDialog(parent)
    //, ui(new Ui::StandardDialogs)
{
    setupUi(this);

    connect(filepushButton, SIGNAL(clicked()),this, SLOT(slotOpenFileDlg()));
    connect(colorpushButton, SIGNAL(clicked()), this, SLOT(slotOpenColorDlg()));
    connect(fontpushButton, SIGNAL(clicked()), this, SLOT(slotOpenFontDlg()));
}

StandardDialogs::~StandardDialogs()
{
    //delete ui;
}

void StandardDialogs::slotOpenFileDlg()
{
    QString s = QFileDialog::getOpenFileName(this,"open file dialog", "/","C++ files(*.cpp);;c files(*.c);;Head files(*.h)");
    filelineEdit->setText(s.toLatin1());
}

void StandardDialogs::slotOpenFontDlg()
{
    bool ok;
    QFont font=QFontDialog::getFont(&ok);
    if(ok)
    {
        fontlineEdit->setFont(font);
    }

}

void StandardDialogs::slotOpenColorDlg()
{

    QColor color=QColorDialog::getColor(Qt::blue);
    if(color.isValid())
    {
        colorframe->setPalette(QPalette(color));
    }
}

